import service from '../utils/axios';

export function getlink(url) {
    return new Promise((resolve, reject) => {
        service
            .request({
                url,
                method: "get",
            })
            .then(ok => {
                resolve(ok);
            })
            .catch(err => {
                reject(err);
            });
    });
}

export let getdata = (url, params) => {
    return new Promise((resolve, reject) => {
        service.request({
            url,
            method: "get",
            params
        }).then((ok) => {
            resolve(ok)
        }).catch((err) => {
            reject(err)
        })
    })
}
export function postdata(url, method = 'post', data) {
    return new Promise((resolve, reject) => {
        service
            .request({
                url,
                method,
                data
            })
            .then(ok => {
                resolve(ok);
            })
            .catch(err => {
                reject(err);
            });
    });
}